import copy

class error_info:
    def __init__(self, start_time, end_time, message):
        self.start_time = start_time
        self.end_time = end_time
        self.message = message
    def __init__(self):
        self.start_time = 0.0
        self.end_time = 0.0
        self.message = ""

def update_error_info(timestamp, reulst, message, dict_error_info, error_info_key, arry_error_info):
    if dict_error_info.get(error_info_key) is None:
        dict_error_info.setdefault(error_info_key, error_info())
    if reulst:
        if  dict_error_info[error_info_key].start_time == 0.0:
            dict_error_info[error_info_key].start_time = timestamp
            dict_error_info[error_info_key].end_time = 0.0
            dict_error_info[error_info_key].message = message
    else:
        dict_error_info[error_info_key].end_time = timestamp
        if dict_error_info[error_info_key].start_time != 0.0:
            arry_error_info.append(copy.deepcopy(dict_error_info[error_info_key]))
            dict_error_info[error_info_key].start_time = 0.0